/* 类型断言 */

// 我知道获取的是具体的HTMLCanvasElement类型，而不是宽泛的HTMLElement类型
// 因此可以断言指定类型
const myCanvas = document.getElementById("main_canvas") as HTMLCanvasElement;
const myCanvas2 = <HTMLCanvasElement>document.getElementById("main_canvas");

const s = "hello"
const x = s as number;
// Error：Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

// 双重断言
const a = (s as any) as number;
